package per.jdz.router;

import per.jdz.common.constants.LoadBalance;
import per.jdz.spi.ExtensionLoader;

import java.io.IOException;

/**
 * @description:
 * @Author: Jdz
 * @CreateTime: 2024-03-16 00:18
 */
public class LoadBalancerFactory {


    public static LoadBalancer get(LoadBalance loadBalance){
        return ExtensionLoader.getInstance().get(loadBalance.name);
    }

    public static LoadBalancer get(String name){
        return ExtensionLoader.getInstance().get(name);
    }

    public static void init() throws IOException, ClassNotFoundException {
        ExtensionLoader.getInstance().loadExtension(LoadBalancer.class);
    }
}

